package com.ruoyi.car.service.parts.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.car.pojo.TbPartTerminalType;

import com.ruoyi.car.mapper.parts.TbPartTerminalTypeMapper;
import com.ruoyi.car.service.parts.ITbPartTerminalTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbPartTerminalTypeServiceImpl implements ITbPartTerminalTypeService {
    @Autowired
    private TbPartTerminalTypeMapper terminalTypeMapper;

    /**
     * 模糊查询：终端型号名称、终端型号编号、终端种类
     * @param terminal_model_name
     * @param terminal_model_id
     * @param terminal_type
     * @return
     */
    @Override
    public List<TbPartTerminalType> terminalTypeList(String terminal_model_name, Long terminal_model_id, Integer terminal_type) {
        QueryWrapper<TbPartTerminalType> tbPartTerminalTypeQueryWrapper = new QueryWrapper<>();
        tbPartTerminalTypeQueryWrapper.like(terminal_model_name !=null ,"terminal_model_name",terminal_model_name);
        tbPartTerminalTypeQueryWrapper.like(terminal_model_id !=null ,"terminal_model_id",terminal_model_id);
        tbPartTerminalTypeQueryWrapper.like(terminal_type !=null ,"terminal_type",terminal_type);
        return this.terminalTypeMapper.selectList(tbPartTerminalTypeQueryWrapper);
    }
    /**
     * 查询该数据下的车载详细信息
     * @param id
     * @return
     */
    @Override
    public TbPartTerminalType terminalTypeById(Long id) {
        return this.terminalTypeMapper.selectById(id);
    }

    @Override
    public int terminalTypeInsert(TbPartTerminalType tbPartTerminalType) {
        return this.terminalTypeMapper.insert(tbPartTerminalType);
    }

    @Override
    public int terminalTypeUpdate(TbPartTerminalType tbPartTerminalType) {
        return this.terminalTypeMapper.updateById(tbPartTerminalType);
    }

    @Override
    public void deleteTbPartSimRecordByIds(String[] ids) {
        this.terminalTypeMapper.deleteTbPartSimRecordByIds(ids);

    }

}
